<?php
namespace  Staff\Controller;
use Think\Controller;
use Think\Page;
use Org\Net\Http;
use Think\Image;
class StaffController extends AuthController{
	public function index(){
		if(IS_POST){
			$staff = session("auth");
			if(I('npwd') == I('rpwd')){
				if(md5(I('opwd')) == $staff['password']){
					$where['id'] = $staff['id'];
					$data['password'] = md5(I('npwd'));
					$result = M("Staff")->where($where)->save($data);
					if($result){
						$this->success('修改成功',__APP__.'/Home/Index/login');
					}else{
						$this->error('修改失败');
					}
				}else{
					$this->error('旧的密码输入不一致');
				}
			}else{
				$this->error('两次密码输入不一致');
			}
		}else{
			$this->display();
		}
	}
}
?>